import React from 'react';
import {Table, Row, Col, Form, Input, Icon, InputNumber, Radio, DatePicker, Select, Upload, Button, Switch, Modal, Popconfirm, Tabs, message} from 'antd';
import BizParams from '../../components/commons/BizParams'
import CurrencySelect from '../../components/commons/CurrencySelect'

const R = require('ramda');
import moment from 'moment'
const TabPane = Tabs.TabPane;
const FormItem = Form.Item;
const dateFormat = 'YYYY-MM-DD';
const view= "view"

export default Form.create({wrappedComponentRef: true})(class Inoviceheader extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            open: false,
            disabled: true,
        }
    }

    handleCancel = () => {
        this.handleResetFields();
    }

    handleResetFields = () => {
        this.props.form.resetFields();
        this.props.dispatch({
            type: "recinvoices/setInoviceheader",
            payload: {
                inoviceheader : {}
            }
        });
    }

    handleConfirm = () => {

    }



    render() {
        const { getFieldDecorator } = this.props.form;
        const formItemLayout = {labelCol: { xs: {span: 8}, sm: {span: 8}}, wrapperCol: {xs: {span: 15}, sm: {span: 14}}};
        let dataSource = R.isNil(this.props.dataSource) || R.isEmpty(this.props.dataSource) ? {} : this.props.dataSource[0];

        return (
            <Form>
                <Row>
                    <Col span={12}>
                        <FormItem
                            {...formItemLayout}
                            label="订单号"
                            hasFeedback
                        >
                            <div>
                                {getFieldDecorator('orderno', {
                                    initialValue: dataSource.orderno
                                })(
                                    <InputNumber style={{width: '100%'}} disabled={true} />
                                )}
                            </div>
                        </FormItem>
                    </Col>
                    <Col span={12}>
                        <FormItem
                            {...formItemLayout}
                            label="开票方式"
                            hasFeedback
                        >
                            <div>
                                {getFieldDecorator('drawertype', {
                                    initialValue:dataSource.drawertype
                                })(
                                    <InputNumber style={{width: '100%'}} disabled={true} />
                                )}
                            </div>
                        </FormItem>
                    </Col>
                </Row>
                <Row>
                    <Col span={12}>
                        <FormItem
                            {...formItemLayout}
                            label="费用"
                            hasFeedback
                        >
                            <div>
                                {getFieldDecorator('cost', {
                                    initialValue:dataSource.cost
                                })(
                                    <InputNumber style={{width: '100%'}} disabled={true} />
                                )}
                            </div>
                        </FormItem>
                    </Col>
                    <Col span={12}>
                        <FormItem
                            {...formItemLayout}
                            label="结汇款"
                            hasFeedback
                        >
                            <div>
                                {getFieldDecorator('remittance', {
                                    initialValue:dataSource.remittance
                                })(
                                    <InputNumber style={{width: '100%'}} disabled={true} />
                                )}
                            </div>
                        </FormItem>
                    </Col>
                </Row>
                <Row>
                    <Col span={12}>
                        <FormItem {...formItemLayout} label="价格方式" hasFeedback>
                            <div>
                                {getFieldDecorator('priceclause', {
                                    initialValue:dataSource.priceitem
                                })(
                                    // <InputNumber style={{width: '100%'}} disabled={true} />
                                    <BizParams sprCode='priceItem' disabled={true} />
                                )}
                            </div>
                        </FormItem>
                    </Col>
                    <Col span={12}>
                        <FormItem
                            {...formItemLayout}
                            label="报关金额"
                            hasFeedback
                        >
                            <div>
                                {getFieldDecorator('declaration', {
                                    initialValue:dataSource.declaration
                                })(
                                    <InputNumber style={{width: '100%'}} disabled={true} />
                                )}
                            </div>
                        </FormItem>
                    </Col>
                </Row>
                <Row>
                    <Col span={12}>
                        <FormItem
                            {...formItemLayout}
                            label="费用申报"
                            hasFeedback
                        >
                            <div>
                                {getFieldDecorator('chargeStatus', {
                                    initialValue:dataSource.chargeStatus
                                })(
                                    <InputNumber style={{width: '100%'}} disabled={true} />
                                )}
                            </div>
                        </FormItem>
                    </Col>
                    <Col span={12}>
                        <FormItem
                            {...formItemLayout}
                            label="合同协议号"
                            hasFeedback
                        >
                            <div>
                                {getFieldDecorator('contractno', {
                                    initialValue:dataSource.contractno
                                })(
                                    <InputNumber style={{width: '100%'}} disabled={true} />
                                )}
                            </div>
                        </FormItem>
                    </Col>

                    <Col span={12}>
                        <FormItem
                            {...formItemLayout}
                            label="总数量"
                            hasFeedback
                        >
                            <div>
                                {getFieldDecorator('totalnum', {
                                    initialValue:dataSource.totalnum
                                })(
                                    <InputNumber style={{width: '100%'}} disabled={true} />
                                )}
                            </div>
                        </FormItem>
                    </Col>
                    <Col span={12}>
                        <FormItem
                            {...formItemLayout}
                            label="含税总金额"
                            hasFeedback
                        >
                            <div>
                                {getFieldDecorator('totalprice', {
                                    initialValue:this.props.totalprice
                                })(
                                    <InputNumber style={{width: '100%'}} disabled={true} />
                                )}
                            </div>
                        </FormItem>
                    </Col>
                </Row>
            </Form>
        );
    }
})


